package com.fsserver.config;

import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WechatPayConfig {

    @Value("${wechat.pay.merchantId}")
    private String merchantId;

    @Value("${wechat.pay.merchantSerialNumber}")
    private String merchantSerialNumber;

    @Value("${wechat.pay.apiV3Key}")
    private String apiV3Key;

    @Value("${wechat.pay.privateKeyPath}")
    private String privateKeyPath;

    @Value("${wechat.pay.notifyUrl}")
    private String notifyUrl;

    @Bean
    public Config wechatPayConfig() {
        return new RSAAutoCertificateConfig.Builder()
                .merchantId(merchantId)
                .merchantSerialNumber(merchantSerialNumber)
                .privateKeyFromPath(privateKeyPath)
                .apiV3Key(apiV3Key)
                .build();
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }
    
    public String getMerchantId() {
        return merchantId;
    }

    public String getMerchantSerialNumber() {
        return merchantSerialNumber;
    }

    public String getApiV3Key() {
        return apiV3Key;
    }

    public String getPrivateKeyPath() {
        return privateKeyPath;
    }
} 